package com.xiaochong.tir.api.userclient;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Project : XcWalletApi
 * @Package Name : com.xiaochong.xt.userclient
 * @Description : TODO
 * @Author : daizhiqing@xiaochong.com
 * @Creation Date : 2018年07月19日下午4:19
 * @ModificationHistory Who When What
 */
@FeignClient(name = "service-user")
public interface UserServiceClient {

    /**
     * 验证用户Token
     * @param userToken
     * @return
     */
    @PostMapping("/services/user/checkUserToken")
    String checkUserToken(@RequestParam(value = "userToken", required = true) String userToken);

    /**
     * 注册
     * @param countryNum
     * @param account
     * @param password
     * @param code
     * @param codeToken
     * @param platform
     * @return
     */
    @PostMapping("/services/user/register")
    String userRegister(@RequestParam(value = "countryNum", required = false) String countryNum,
                        @RequestParam(value = "account", required = true) String account,
                        @RequestParam(value = "password", required = true) String password,
                        @RequestParam(value = "code", required = true) String code,
                        @RequestParam(value = "codeToken", required = true) String codeToken,
                        @RequestParam(value = "platform", required = true) Integer platform);

    /**
     * 发送验证码
     * @param countryNum
     * @param account
     * @param platform
     * @param type
     * @param params
     * @return
     */
    @PostMapping("/services/user/sendValidCode")
    String sendValidCode(@RequestParam(value = "countryNum", required = false) String countryNum,
                         @RequestParam(value = "account", required = true) String account,
                         @RequestParam(value = "platform", required = true) Integer platform,
                         @RequestParam(value = "type", required = true) Integer type,
                         @RequestParam(value = "params", required = false) String params);

    /**
     * 平台自己单独校验验证码
     * @param token
     * @param code
     * @return
     */
	@PostMapping("/services/user/validPlatformSmsCode")
	String validPlatformSmsCode(@RequestParam(value = "token") String token,
                                @RequestParam(value = "code") String code);

    /**
     * 短信登录
     * @param countryNum
     * @param phone
     * @param code
     * @param codeToken
     * @param platform
     * @return
     */
    @PostMapping("/services/user/smsCodeLogin")
    String validCodeLogin(@RequestParam(value = "countryNum", required = false) String countryNum,
                          @RequestParam(value = "phone", required = true) String phone,
                          @RequestParam(value = "code", required = true) String code,
                          @RequestParam(value = "codeToken", required = true) String codeToken,
                          @RequestParam(value = "platform", required = true) Integer platform);

    /**
     * 账号密码登录
     * @param account
     * @param password
     * @param platform
     * @return
     */
    @PostMapping("/services/user/userPwdLogin")
    String pwdLogin(@RequestParam(value = "account", required = true) String account,
                    @RequestParam(value = "password", required = true) String password,
                    @RequestParam(value = "platform", required = true) Integer platform);

    /**
     * 修改用户密码
     * @param account
     * @param password
     * @param code
     * @param codeToken
     * @param platform
     * @return
     */
    @PostMapping("/services/user/updateUserPwd")
    String updateUserPwd(@RequestParam(value = "account", required = true) String account,
                         @RequestParam(value = "password", required = true) String password,
                         @RequestParam(value = "code", required = true) String code,
                         @RequestParam(value = "codeToken", required = true) String codeToken,
                         @RequestParam(value = "platform", required = true) Integer platform);

    /**
     * 绑定邮箱
     * @param mobile
     * @param email
     * @param code
     * @param codeToken
     * @param platform
     * @return
     */
    @PostMapping("/services/user/bindEmail")
    String bindEmail(@RequestParam(value = "mobile", required = true) String mobile,
                     @RequestParam(value = "email", required = true) String email,
                     @RequestParam(value = "code", required = true) String code,
                     @RequestParam(value = "codeToken", required = true) String codeToken,
                     @RequestParam(value = "platform", required = true) Integer platform);

    /**
     * 根据老密码修改成新密码
     * @param account
     * @param password
     * @param newPassword
     * @param code
     * @param codeToken
     * @param platform
     * @return
     */
    @PostMapping("/services/user/updateUserPwdByOld")
    String updateUserPwdByOldPwd(@RequestParam(value = "account", required = true) String account,
                                 @RequestParam(value = "password", required = true) String password,
                                 @RequestParam(value = "newPassword", required = true) String newPassword,
                                 @RequestParam(value = "code", required = true) String code,
                                 @RequestParam(value = "codeToken", required = true) String codeToken,
                                 @RequestParam(value = "platform", required = true) Integer platform);

    /**
     * 注销登录
     * @param userToken
     * @return
     */
    @PostMapping("/services/user/logoutUserToken")
    String logoutUserToken(@RequestParam(value = "userToken", required = true) String userToken);

    /**
     * 获取邀请码
     * @param account
     * @param paltform
     * @return
     */
    @PostMapping("/services/invite/getUserInviteCode")
    String getUserInviteCode(@RequestParam(value = "account") String account, @RequestParam(value = "paltform") Integer paltform);

    /**
     * 保存用户邀请记录
     * @param vcode
     * @param account
     * @param fromPlatform
     * @param toPlatform
     * @param activityType
     * @return
     */
    @PostMapping("/services/invite/saveUserInviteRecord")
    String saveUserInviteRecord(@RequestParam(value = "vcode") String vcode, @RequestParam(value = "account") String account,
                                @RequestParam(value = "fromPlatform") Integer fromPlatform, @RequestParam(value = "toPlatform") Integer toPlatform,
                                @RequestParam(value = "activityType") Integer activityType);
    /**(value = "获取用户的邀请记录", notes = "返回信息如下:" +
            "code:" +
            "000000(成功)" +
            "000004(查询数据为空)" +
     **/
    @PostMapping("getInviteRecord")
    String getInviteRecord(@RequestParam(value = "account") String account,
                           @RequestParam(value = "pageNum") int pageNum,
                           @RequestParam(value = "pageSize") int pageSize);

    /**
     * (value = "获取用户的被邀请记录", notes = "返回信息如下:" +
     *             "code:" +
     *             "000000(成功)" +
     *             "000004(查询数据为空)" +
     *             "500000(异常情况)")
     */
    @PostMapping("findInvitedRecord")
    String findInvitedRecord(@RequestParam(value = "account") String account);


    /**
     * 检查用户账户
     *
     * @param account
     *            用户账户
     * @return
     */
    @PostMapping("/services/user/checkAccount")
    String checkAccount(@RequestParam(value = "account", required = true) String account);
}
